package com.example.personalizededucationsystem.service.recommendation;

import com.example.personalizededucationsystem.model.Question;
import com.example.personalizededucationsystem.model.User;
import com.example.personalizededucationsystem.repository.QuestionRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("randomStrategy")
public class RandomStrategy implements RecommendationStrategy {

    private final QuestionRepository questionRepository;

    @Autowired
    public RandomStrategy(QuestionRepository questionRepository) {
        this.questionRepository = questionRepository;
    }

    @Override
    public List<Question> recommend(User student, String subject, int count) {
        return questionRepository.findRandomApprovedQuestionsBySubject(subject, count);
    }

    @Override
    public String getStrategyName() {
        return "RANDOM";
    }
}